package com.orifine.sql.simple;

public class SimpleDeleteBuilder {
	private static final String AND = ") \nAND (";
	private static final String OR = ") \nOR (";
	
	private SimpleSql sql;
	
	public SimpleDeleteBuilder() {
		sql = new SimpleSql();
	}
	
	public  SimpleDeleteBuilder deleteFrom(String table) {
		sql.statementType = SimpleSql.StatementType.DELETE;
		sql.tables.add(table);
		return this;
	}
	
	public  SimpleDeleteBuilder join(String join) {
		sql.join.add(join);
		return this;
	}

	public  SimpleDeleteBuilder innerJoin(String join) {
		sql.innerJoin.add(join);
		return this;
	}

	public  SimpleDeleteBuilder leftOuterJoin(String join) {
		sql.leftOuterJoin.add(join);
		return this;
	}

	public  SimpleDeleteBuilder rightOuterJoin(String join) {
		sql.rightOuterJoin.add(join);
		return this;
	}

	public  SimpleDeleteBuilder outerJoin(String join) {
		sql.outerJoin.add(join);
		return this;
	}

	public  SimpleDeleteBuilder where(String conditions) {
		sql.where.add(conditions);
		sql.lastList = sql.where;
		return this;
	}

	public  SimpleDeleteBuilder or() {
		sql.lastList.add(OR);
		return this;
	}

	public  SimpleDeleteBuilder and() {
		sql.lastList.add(AND);
		return this;
	}
	
	public String toString(){
		return sql.deleteSQL();
	}
}
